package com.jia.leetCode;

/**
 * 829.连续整数求和
 */
public class Pro0829 {
    public int consecutiveNumbersSum(int N) {
        int ans = 0;
        for(int i = 1; i <= N; i++) {
            int sum = 0;
            for(int j = i; j <= N; j++) {
                if(sum + j == N) {
                    ++ans;
                }else if(sum + j > N){
                    break;
                }
                sum+=j;
            }
        }
        return ans;
    }
}
